package com.freshcity.manager
{
	import com.freshcity.component.tooltip.Tooltip;
	import com.freshcity.graphics.Background;
	import com.freshcity.graphics.BusStop;
	import com.freshcity.manager.support.UILayer;
	import com.freshcity.manager.support.WindowLayer;
	import com.freshcity.page.home.MainNav;
	import com.greensock.TweenLite;
	import com.pblabs.core.IPBManager;
	import com.pblabs.time.ITicked;
	
	import flash.display.DisplayObjectContainer;
	import com.freshcity.lib.tooltip.ToolTipsManager;
	
	public class LayerManager implements IPBManager,ITicked
	{
		public static var uiLayer:UILayer;
		
		public static var windowLayer:WindowLayer;
		
		public static var topLayer:UILayer;
		
		public static var popupLayer:UILayer;
		
		public static var guideLayer:UILayer;
		
		public static var alertLayer:UILayer;
		
		public static var dragLayer:UILayer;
		
		public static var toolTipLayer:UILayer;
		
		public static var msgTipLayer:UILayer;
		
		public static var highestLayer:UILayer;
		
		public static var sceneLayer:UILayer;
		
		public var rootClass:DisplayObjectContainer;
		
		public var background:Background;
		private var targetFrame:int;
		
		public function initialize():void
		{
			sceneLayer=new UILayer();
			sceneLayer.name = "sceneLayer";
			rootClass.addChild(sceneLayer);
			
			uiLayer=new UILayer();
			uiLayer.name = "uiLayer";
			rootClass.addChild(uiLayer);	
			
			windowLayer = new WindowLayer();
			rootClass.addChild(windowLayer);
			
			topLayer = new UILayer();
			rootClass.addChild(topLayer);			
			
			popupLayer = new UILayer();
			popupLayer.name="popupLayer";
			rootClass.addChild(popupLayer);
			
			guideLayer = new UILayer();
			guideLayer.name="guideLayer";
			rootClass.addChild(guideLayer);
			
			alertLayer = new UILayer();
			alertLayer.name="alertLayer";
			rootClass.addChild(alertLayer);
			//Alert.init(alertLayer);
			
			dragLayer = new UILayer();
			dragLayer.name="dragLayer";
			rootClass.addChild(dragLayer);
			DragManager.init(dragLayer);
			
			//CursorManager.init(PBE.rootClassStage);
			//MsgManager.addBroadStage(windowLayer);
			//MsgManager.addIssmNoticeItemPanelStage(PBE.rootClassClass);
			msgTipLayer = new UILayer();
			msgTipLayer.name="msgTipLayer";
			rootClass.addChild(msgTipLayer);
			
			toolTipLayer = new UILayer();
			toolTipLayer.name="toolTipLayer";
			ToolTipsManager.init(toolTipLayer,com.freshcity.component.tooltip.Tooltip);
			
			rootClass.addChild(toolTipLayer);
			
			highestLayer = new UILayer();
			highestLayer.name="highestLayer";
			rootClass.addChild(highestLayer);
			
			background = new Background();
			background.cacheAsBitmap = true;
			rootClass.addChildAt(background,0);
			
		}
		
		public function onTick():void
		{
			if(background.busView.currentFrame <= targetFrame){
				//background.busView.nextFrame();
			}
		}		
		
		public function leave():void
		{
			targetFrame = 60;
			
			//background.busView.gotoAndStop(0);
		}
		
		public function comeIn():void
		{
			//targetFrame = 120;
			//background.busView.busBoard.busName.text="三元桥";
			//background.busView.gotoAndStop(61);
		}
		
		public function destroy():void
		{
		}
	}
}